﻿using System;
using System.Net;
using Common.ParameterLocator;

namespace SpecFlowTfsConnector
{
    public static class TfsCredential
    {
        public static ICredentials CreateCredentialsFromParameters()
        {
            return new NetworkCredential(ServiceParameter.Instance.Parameter.TfsUserNameConnexion,
                                         ServiceParameter.Instance.Parameter.TfsPasswordConnexion);
        }

        public static bool CredentialsAreProvided()
        {
            return !String.IsNullOrEmpty(ServiceParameter.Instance.Parameter.TfsUserNameConnexion) ||
                   !String.IsNullOrEmpty(ServiceParameter.Instance.Parameter.TfsPasswordConnexion);
        }
    }
}